#!/bin/bash

if [[ "$1" == "" ]]; then
  printf "Unset Photivo repo."
  unset PhotivoRepoPath
  unset PhotivoBuildPath
  export PhotivoRepoId=none

else
  if [[ "$1" == "def" ]]; then
    ptTempPath=/C/Projekte/Photivo/repository
  else
    if [[ -e /C/Projekte/Photivo/branch-$1 ]]; then
      ptTempPath=/C/Projekte/Photivo/branch-$1
    else
      ptTempPath=/C/Projekte/Photivo/$1
    fi
  fi

  if [[ ! -e $ptTempPath ]]; then
    echo "Folder \"$ptTempPath\" does not exist."
  else
    export PhotivoRepoPath=$ptTempPath
    export PhotivoBuildPath=$ptTempPath/build-$GccArch
    export PhotivoRepoId=$1
    printf "\n\$PhotivoRepoPath  is now \"$PhotivoRepoPath\"\n"
    printf   "\$PhotivoBuildPath is now \"$PhotivoBuildPath\"\n"
    unset ptTempPath
  fi
fi